﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeManageService;

namespace WeManageForm
{
    public class Global
    {
        public static string UserName { get; set; }
		public static DateTime SundayThisWeek
		{
			get
			{
				DateTime time = DateTime.Now.Date;
				return time.AddDays(-(int)time.DayOfWeek);
			}
		}

		public static string GetEmptyHintTextBoxValue(TextBox textBox)
		{
			if (textBox.ForeColor == SystemColors.GrayText) return "";
			else return textBox.Text;
		}

		public static void SetEmptyHintTextBoxValue(TextBox textBox, string text)
		{
			if (text == "")
			{
				textBox.Text = "这里空空的哦...";
				textBox.ForeColor = SystemColors.GrayText;
			}
			else
			{
				textBox.Text = text;
				textBox.ForeColor = SystemColors.ControlText;
			}
		}

		public static void EmptyHintTextBox_GotFocus(object sender, EventArgs e)
		{
			TextBox textBox = sender as TextBox;
			if (textBox.ForeColor == SystemColors.GrayText)
			{
				textBox.Text = "";
				textBox.ForeColor = SystemColors.ControlText;
			}
		}


		public static void EmptyHintTextBox_LostFocus(object sender, EventArgs e)
		{
			TextBox textBox = sender as TextBox;
			if (textBox.Text == "")
			{
				textBox.ForeColor = SystemColors.GrayText;
				textBox.Text = "这里空空的哦...";
			}
		}
	}
}
